package com.mh.config;

import com.mh.common.UserLoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

/**
 * Date:2024/10/18
 * author:zmh
 * description: MVC配置类
 **/


@Configuration
public class WebMvcConfig extends WebMvcConfigurationSupport {

    /**
     * 注册自定义拦截器
     * @param registry ·
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new UserLoginInterceptor())
                .addPathPatterns("/userInfos/checkLogin",
                        "/orderInfos/**",
                        "/userInfos/getGoodsStartByUserId/**",
                        "/couponInfos/**"
                        );// 拦截的地址
//                .excludePathPatterns("/userInfos/login/**"); // 放行多个地址，使用逗号分隔路径地址
    }
}
